Skip to content

Conversation

@seratch
Copy link
Member

@seratch seratch commented Aug 28, 2025

This pull request resolves #374

@changeset-bot
Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: 47b7318

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@openai/agents-core Patch
@openai/agents-openai Patch
@openai/agents-realtime Patch
@openai/agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +140 to +166
(| {
serverLabel: string;
serverUrl?: string;
authorization?: string;
headers?: Record<string, string>;
}
: {
type: 'mcp',
server_label: options.serverLabel,
server_url: options.serverUrl,
allowed_tools: toMcpAllowedToolsFilter(options.allowedTools),
headers: options.headers,
require_approval:
typeof options.requireApproval === 'string'
? 'always'
: buildRequireApproval(options.requireApproval),
on_approval: options.onApproval,
};
return {
type: 'hosted_tool',
name: 'hosted_mcp',
providerData,
};
// OpenAI Connector
| {
serverLabel: string;
connectorId: string;
authorization?: string;
headers?: Record<string, string>;
}
) &
(
| { requireApproval?: never }
| { requireApproval: 'never' }
| {
requireApproval:
| 'always'
| {
never?: { toolNames: string[] };
always?: { toolNames: string[] };
};
onApproval?: HostedMCPApprovalFunction<Context>;
}
),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Require either serverUrl or connectorId for hosted MCP tools

The new overload for hostedMcpTool makes serverUrl optional in both branches while connectorId is only required in the connector branch. Because the runtime dispatch simply checks 'serverUrl' in options and 'connectorId' in options, it is now possible to call hostedMcpTool({ serverLabel: 'foo' }) without either value; this compiles and returns provider data that lacks both server_url and connector_id. When the model later tries to invoke the tool, OpenAI will reject the call because no endpoint or connector is specified, whereas the previous signature enforced the required field at compile time. Consider keeping serverUrl mandatory for non‑connector usage and validating that one of the two identifiers is provided so misconfigurations are caught early.

Useful? React with 👍 / 👎.

@seratch seratch merged commit ecea142 into main Aug 28, 2025
5 checks passed
@seratch seratch deleted the issue-374-connector branch August 28, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add connector support

3 participants